package com.yy.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

/**
 * 自己的拦截器.实现 Spring 的拦截器(Servlet, Filter, Listener都是实现jdk的)
 * 自己定义的拦截器需要定义一个新的类继承WebMvcConfigurerAdapter重写addInterceptor方法从而添加进去 (本项目看config下的MySpringInterceptorRegister)
 * @author SEELE
 *
 */
public class StevenInterceptor implements HandlerInterceptor  {

	@Override
	public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object obj, Exception ex)
			throws Exception {
		System.out.println(this.getClass().getName() + " ----> afterCompletion");
	}

	@Override
	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object obj, ModelAndView model)
			throws Exception {
		System.out.println(this.getClass().getName() + " ----> postHandle");
	}

	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) throws Exception {
		System.out.println(this.getClass().getName() + " ----> preHandle");
		return true;
	}

}
